import React from 'react';

import "./Page5.css";

//表单的数据双向绑定

class Page5 extends React.Component {
	
	constructor(){
		//super() 必须是第一句 调用父类的构造函数
		super();
		this.state = {
			msg: ''
		}
	}

	changeInput = (e) => {
		this.setState({
			msg: e.target.value
		})
		console.log(this);
	}
	
    render() {
        return (
            <div className="p2">
				<h1>Page 2 的数据是: {this.state.msg}</h1>
				<p>
					<input type="text" value={this.state.msg} onChange={this.changeInput}/>
				</p>
            </div>
        );
    }
}

export default Page5;
